﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZG_member.DAL;
using ZG_member.Model;
using System.Data;

namespace ZG_member.BLL
{
    public class ConsProcManager
    {
        public List<ZG_member.Model.ConsProc> GtList()
        {
            DataSet ds = new DBHelper().GetDataSet("exec CardTypeProc");

            List<ZG_member.Model.ConsProc> list = new List<ZG_member.Model.ConsProc>();

            int count = ds.Tables[0].Rows.Count;

            for (int i = 0; i < count; i++)
            {
                ZG_member.Model.ConsProc b = new ZG_member.Model.ConsProc();
                b.id = Convert.ToInt32(ds.Tables[0].Rows[i]["id"]);
                b.solutionName = ds.Tables[0].Rows[i]["solutionName"].ToString();
                b.name = ds.Tables[0].Rows[i]["name"].ToString();
                b.consumeSolution1 = ds.Tables[0].Rows[i]["consumeSolution1"].ToString();
                b.savingSolution = ds.Tables[0].Rows[i]["savingSolution"].ToString();
                b.discountSolution = ds.Tables[0].Rows[i]["discountSolution"].ToString();
                b.nextLevelId = ds.Tables[0].Rows[i]["nextLevelId"].ToString();
                b.levelUp = Convert.ToInt32(ds.Tables[0].Rows[i]["levelUp"].ToString() == "" ? 0 : ds.Tables[0].Rows[i]["levelUp"]);
                b.integralday=Convert.ToInt32(ds.Tables[0].Rows[i]["integralday"].ToString());
                b.cuxiaozhekou = Convert.ToBoolean(ds.Tables[0].Rows[i]["cuxiaozhekou"].ToString());
                if (b.levelUp == 0)
                {
                    b.levelUp = null;
                }
                b.leaveDate = ds.Tables[0].Rows[i]["leaveDate"].ToString();
                list.Add(b);

            }
            
            return list;


        }
    }
}
